<?php if( empty( $_SESSION )){session_start();}header("Content-Type: text/html; charset=utf-8",true);include_once("../includes/restrito.php");include_once("../includes/cls.config.php");$oMysql = new mysql();?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../includes/sistema.css"/>
<link href="../includes/panels.css" rel="stylesheet" type="text/css" />
<script src="../includes/panels.js" type="text/javascript"></script>
<div id="content">
<h1>REVISTA CAPOTERAPIA</h1>
<hr />

  
		  <div id="TabbedPanels1" class="TabbedPanels">
		    <ul class="TabbedPanelsTabGroup">
		      <li class="TabbedPanelsTab" tabindex="0">Edição Publicada</li>
   		      <li class="TabbedPanelsTab" tabindex="0">Matérias na Capa</li>
		      <li class="TabbedPanelsTab" tabindex="0">Índices do Sumário</li>
	        </ul>
		    <div class="TabbedPanelsContentGroup">
		      <div class="TabbedPanelsContent">
              		
                  <p>
				  <?php
				  
							  
					function formatar_data( $data , $tipo )
					{
						if( $tipo == 'put' )
						{
							$d = explode("/" , $data);
							$d = $d[2] . "-" . $d[1] . "-" . $d[0];
							return $d;
						}
						else
						{
							$d = explode("-" , $data);
							$d = $d[2] . "/" . $d[1] . "/" . $d[0];
							return $d;
						}
					}

				  
				  
				  
                    $sql = "SELECT
                                r.nome,
                                r.ano,
                                r.data,
                                r.numero,
                                i.sigla
                            FROM
                                revista r
                            INNER JOIN
                                idioma i
                            ON
                                r.id_idioma = i.id
                            WHERE
                                r.situacao=1
                            AND
                                r.publicar=1
                            AND
                                i.situacao=1";
                                
                    $pRecurso = $oMysql->qry( $sql );
                    $aSaida = array();
                    while($aCapa = mysql_fetch_array( $pRecurso , MYSQL_ASSOC ) )
                    {
                        $aSaida[] = $aCapa;
                    }
                    echo '
                    </p>
                    <table width="95%" border="0" cellspacing="2" cellpadding="5" align="center">
                      <tr>
                        <td width="20%" align="center" bgcolor="#DFDFDF"><strong>Idioma</strong></td>
                        <td width="20%" align="center" bgcolor="#DFDFDF"><strong>Edi&ccedil;&atilde;o</strong></td>
                        <td width="20%" align="center" bgcolor="#DFDFDF"><strong>Data</strong></td>
                        <td width="20%" align="center" bgcolor="#DFDFDF"><strong>Ano</strong></td>
                        <td width="20%" align="center" bgcolor="#DFDFDF"><strong>Número</strong></td>
                      </tr>
					';
                    foreach( $aSaida as $sItem )
                    {
					echo '
                      <tr>
                        <td width="20%" height="35" align="center" bgcolor="#FFFFFF"><img src="imagens/' . strtolower( $sItem['sigla'] ) . '.gif" border="0"><br /></td>
                        <td width="20%" height="35" align="center" bgcolor="#FFFFFF">' . $sItem['nome'] . '</td>
                        <td width="20%" height="35" align="center" bgcolor="#FFFFFF">' . formatar_data( $sItem['data'] , 'get' ) . '</td>
                        <td width="20%" height="35" align="center" bgcolor="#FFFFFF">' . $sItem['ano'] . '</td>
                        <td width="20%" height="35" align="center" bgcolor="#FFFFFF">' . $sItem['numero'] . '</td>
                      </tr>
                    <p>
					';
                    }
					echo '
                    </table>				
					';
	                ?>
					</p>
				              
              </div>
              
              
              
              
              		      <div class="TabbedPanelsContent">
              
                  <p>
				  <?php
                    $sql = "SELECT p.titulo, p.subtitulo, i.sigla
							FROM pagina p INNER JOIN revista r
							ON p.id_revista = r.id
							INNER JOIN idioma i
							ON
							r.id_idioma = i.id
							WHERE
							r.situacao=1
							AND
							p.capa=1
							AND
							i.situacao=1
							ORDER BY r.id_idioma, p.ordem DESC
							";
                                
                    $pRecurso = $oMysql->qry( $sql );
                    $aSaida = array();
                    while($aCapa = mysql_fetch_array( $pRecurso , MYSQL_ASSOC ) )
                    {
                        $aSaida[] = $aCapa;
                    }
                    
					echo '
                    </p>
                    <table width="95%" border="0" cellspacing="2" cellpadding="5" align="center">
                      <tr>
						<td width="5%" align="center" bgcolor="#DFDFDF"><strong>Idioma</strong></td>
                        <td width="45%" align="left" bgcolor="#DFDFDF"><strong>Título</strong></td>
                        <td width="45%" align="left" bgcolor="#DFDFDF"><strong>Subtítulo</strong></td>
                      </tr>
					
					';
                    foreach( $aSaida as $sItem )
                    {
					echo '
                      <tr>
					  	<td width="5%" height="35" align="center" bgcolor="#FFFFFF"><img src="imagens/' . strtolower( $sItem['sigla'] ) . '.gif" border="0"></td>
                        <td width="40%" height="35" align="left" bgcolor="#FFFFFF">' . $sItem['titulo'] . '</td>
                        <td width="40%" height="35" align="left" bgcolor="#FFFFFF">' . $sItem['subtitulo'] . '</td>
                      </tr>
					';
                    }
					echo '
	                    </table>
                    <p>

					';
	                ?>
					</p>
              
              </div>

              
		      <div class="TabbedPanelsContent">
              
                  <p>
				  <?php
                    $sql = "SELECT pi.titulo, pi.subtitulo, i.sigla
							FROM pagina_indice pi INNER JOIN revista r
							ON pi.id_revista = r.id
							INNER JOIN idioma i
							ON
							r.id_idioma = i.id
							WHERE
							r.situacao=1
							AND
							r.publicar=1
							AND
							i.situacao=1
							ORDER BY r.id_idioma, pi.ordem ASC
							";
                                
                    $pRecurso = $oMysql->qry( $sql );
                    $aSaida = array();
                    while($aCapa = mysql_fetch_array( $pRecurso , MYSQL_ASSOC ) )
                    {
                        $aSaida[] = $aCapa;
                    }
                    
					echo '
                    </p>
                    <table width="95%" border="0" cellspacing="2" cellpadding="5" align="center">
                      <tr>
						<td width="5%" align="center" bgcolor="#DFDFDF"><strong>Idioma</strong></td>
                        <td width="45%" align="left" bgcolor="#DFDFDF"><strong>Título</strong></td>
                        <td width="45%" align="left" bgcolor="#DFDFDF"><strong>Subtítulo</strong></td>
                      </tr>
					
					';
                    foreach( $aSaida as $sItem )
                    {
					echo '
                      <tr>
					  	<td width="5%" height="35" align="center" bgcolor="#FFFFFF"><img src="imagens/' . strtolower( $sItem['sigla'] ) . '.gif" border="0"></td>
                        <td width="45%" height="35" align="left" bgcolor="#FFFFFF">' . $sItem['titulo'] . '</td>
                        <td width="45%" height="35" align="left" bgcolor="#FFFFFF">' . $sItem['subtitulo'] . '</td>
                      </tr>
					';
                    }
					echo '
						
	                    </table>
                    <p>

					
					';
	                ?>
					</p>
              
              </div>
              
	        </div>
	    </div>
    

</div>
<script type="text/javascript">
<!--
var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");
//-->
</script>